//
//  EucledianDistanceFitness.h
//  symbrion
//
//  Created by Berend Weel on 4/16/13.
//  Copyright (c) 2013 Berend Weel. All rights reserved.
//

#ifndef symbrion_EucledianDistanceFitness_h
#define symbrion_EucledianDistanceFitness_h

#include "FitnessMeasure.h"

class EucledianDistanceFitness : public FitnessMeasure {
public:
    EucledianDistanceFitness(WorldModel *worldModel) : FitnessMeasure(worldModel){
        
    }
    
    virtual void reset(){
        xStart = worldModel->xPos;
        yStart = worldModel->yPos;
    }
    
    virtual LIOReal calculate() {
        LIOReal xdiff = worldModel->xPos - xStart;
        LIOReal ydiff = worldModel->yPos - yStart;
        LIOReal fitness = std::sqrt((xdiff * xdiff) + (ydiff * ydiff));
        
        return fitness;
    }
    
private:
    LIOReal xStart, yStart;
};

#endif
